<%-- 
    Document   : index
    Created on : 13/06/2013, 08:52:48 PM
    Author     : Carlo Vera (LastStandMan Java)
--%>
<%@page import="javax.jms.Queue"%>
<%@page import="javax.jms.Session"%>
<%@page import="javax.jms.Connection"%>
<%@page import="javax.jms.QueueConnectionFactory"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.jms.MessageProducer"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
      probas JMS    
    <body>
        <h1>Hello World Java!</h1>
        
        <%
    try{
            InitialContext context = new InitialContext();
            QueueConnectionFactory cF = 

(QueueConnectionFactory)context.lookup("jms/QueueFactoryPro");
            Queue queue = (Queue)context.lookup("jms/QueuePro");

            Connection cnn = cF.createConnection();
            Session sess = cnn.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            MessageProducer messProd= 
                    sess.createProducer(queue);

            messProd.send(sess.createTextMessage("Prueba"));
            messProd.close();
            sess.close();
            cnn.close();
            out.println("El mensaje se envio OK");

         }catch(Exception e){
          out.println("No fue posible enviar el mensaje:"+e.getMessage());
         }
        %>
        
        
    </body>
</html>
